package nobu.nakata.nfcfare.resource.mapper;

import javax.jdo.PersistenceManager;

import net.sf.jsr107cache.Cache;
import nobu.nakata.nfcfare.resource.item.ITrainResourceItem;
import nobu.nakata.nfcfare.resource.mapper.strategy.TrainPersistence;
import nobu.nakata.nfcfare.resource.mapper.strategy.TrainCaching;
import nobu.nakata.nfcfare.table.TrainStation;
import nobu.nakata.nfcfare.table.TrainStationHistory;

import com.google.appengine.api.users.User;

public class TrainResourceMapper {
	private ResourceMapper<TrainStation, TrainStationHistory, ITrainResourceItem, Long> mapper;
	
	
	public TrainResourceMapper(Cache cache, PersistenceManager pm, User viewer) {
		this.mapper		= new ResourceMapper<TrainStation, TrainStationHistory, ITrainResourceItem, Long>(
				new TrainCaching(cache), new TrainPersistence(cache, pm, viewer));
	}

	
	public ITrainResourceItem findByTrainStationCode(long trainCode) {
		return mapper.findByKey(trainCode);
	}
	public void set(ITrainResourceItem item) {
		mapper.set(item);
	}
}
